package com.mzj.saas.thread.task;

import com.mzj.saas.mservice.task.WxPayCallBackService;
import com.mzj.saas.mservice.task.WxRefundCallBackService;
import com.mzj.saas.util.SpringUtils;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;
import java.util.TimerTask;

/**
 * @Author Dell
 * @Date 2023/4/23
 **/
@Slf4j
public class WxCallBackOrderTask {

    public static TimerTask callBackOrderPay(final Map<String, String> result) {
        return new TimerTask() {
            @Override
            public void run() {
                SpringUtils.getBean(WxPayCallBackService.class).callBackOrder(result);
            }
        };
    }

    public static TimerTask callBackOrderRelet(final Map<String, String> result) {
        return new TimerTask() {
            @Override
            public void run() {
                SpringUtils.getBean(WxPayCallBackService.class).callBackReletOrder(result);
            }
        };
    }

    /**
     * 账单回调
     * @param result
     * @return
     */
    public static TimerTask callBackBill(final Map<String, String> result) {
        return new TimerTask() {
            @Override
            public void run() {
                SpringUtils.getBean(WxPayCallBackService.class).callBackBill(result);
            }
        };
    }

    /**
     * 订单退款
     * @param result
     * @return
     */
    public static TimerTask callBackOrderRefund(final Map<String, String> result) {
        return new TimerTask() {
            @Override
            public void run() {
                SpringUtils.getBean(WxRefundCallBackService.class).callBackOrder(result);
            }
        };
    }
}
